print(['a']*10)
print('a'*10)
x='a'
print(x*3)
x='你'
print(x*3)
#区别就是'a'在Python的常量池当中，但是列表复制一直是复制的引用
x='y'
l=[x]*3
print(l)

aList=[1,'hhh',3]
aList.append(2)
print(aList)
# aList
aList.insert(2,'aaa')
print(aList)     #[1, 'hhh', 'aaa', 3, 2]
print(aList[1:3])
print(aList[1:])
print(aList[2:])
print(aList[:3])
print(aList[-1])
print(aList[-2])
print(aList[0:4:2])
# print(aList)     [1, 'hhh', 'aaa', 3, 2]
print(aList.index('hhh'))
print(aList.index(2))
aList.insert(aList.index(2),'hahaha')
print(aList)    #[1, 'hhh', 'aaa', 3, 'hahaha', 2]
aList[2]='haaa'
print(aList)
aList[2]='yu'
print(aList)
#pop 删除末尾元素返回，remove删除元素但是不返回，只删除找到的第一个元素
aList.append(1)
print(aList)
print(aList.count(1))
aList.reverse()   #sort在当前列表上做增序排列，返回None
print(aList)
reversed(aList)  #返回新列表
print(aList)
# aList.sort()
# print(aList)
# aList.sort(reverse=False)
# print(aList)
# aList.sort(reverse=True)
# print(aList)

# d={"a":1,"b":2,"c":3,"d":4}

# d_2={"c":3,"d":4}
# d_3=d.update(d_2)  #返回d_3为空
# print(d_3)

# d.setdefault("a", default=None)
phonebook={'ann':6575,'bob':8982,'joe':2598,'zoe':1225}
print(phonebook)
print(phonebook['bob'])
phonebook={'ann':6575,'bob':8982,'joe':2598,'zoe':1225,'ann':6585}
print(phonebook)
print(phonebook['joe'])
phonebook['joe']=5802
print(phonebook)
print(phonebook['joe'])
phonebook1={'a':6,'b':8,'j':2,'z':1,'a':61}
phonebook2={'j':9,'m':5,'s':68,'e':7898}
phonebook1.update(phonebook2)
print(phonebook1)
del phonebook1['b']
print(phonebook1)

print('\n')
print('a' in phonebook1)
print('ab' in phonebook1.keys())
print(68 in phonebook)

s='Python'
for i, c in enumerate(s):
    print(i, c)

print('\n')
for i, v in enumerate(range(3)):
    print(i, v)

phonebook1={'ann':6575,'bob':8982,'joe':2598,'zoe':1225,'ann':6585}
for key, value in phonebook1.items():
    print(key, value)

phonebook1.clear()
print(phonebook1)

a="abcabcdeabcdbcdef"
b=range(10)
c=[1,2,2,3,3,1]
d={'a','b','e','b','a'}
print(set(a))
print(set(b))
print(set(c))
print(set(d))

print('\n')
a="abcabcdeabcdbcdef"
b={x for x in a if x not in 'abc'}
print(b)

admins={'Moose','Joker','Joker'}
moderators={'Ann','Chris','Jane','Moose','Zero'}
print(admins)
print('Joker' in admins)
print('Joker' in moderators)
print(admins | moderators)
print(admins & moderators)
print(admins - moderators)
print(admins ^ moderators)
admins.add('hhh')
print(admins)
print('hhh' in admins)
y={'Joker','aaa'}
admins.update(y)
print(admins)
admins.discard('lalala')
print(admins)
admins.remove('lalala')
# print(admins)

# print('\n')

